//
//  OpenVPNPacketFlowBridge.h
//  OpenVPN Adapter
//
//  Created by Jonathan Downing on 12/10/2017.
//  Modified by Sergey Abramchuk on 15/01/2018.
//

#import <Foundation/Foundation.h>
@class OpenVPNPacket;
NS_ASSUME_NONNULL_BEGIN

@protocol OpenVPNAdapterPacketFlow;

@protocol OpenVPNXBDelegate <NSObject>

- (void)xb_VPNReadPacketFlow:(NSData *)packets;
- (void)xb_VPNWritePacketFlow:(NSData *)packets;

@end

@interface OpenVPNPacketFlowBridge: NSObject

@property (nonatomic, weak) id<OpenVPNAdapterPacketFlow> packetFlow;
/**
 The object that acts as the delegate of the adapter.
 */
@property (nonatomic, weak) id<OpenVPNXBDelegate> xb_delegate;


@property (nonatomic, readonly) CFSocketRef openVPNSocket;
@property (nonatomic, readonly) CFSocketRef packetFlowSocket;

- (BOOL)configureSocketsWithError:(NSError **)error;
- (void)invalidateSocketsIfNeeded;

- (void)startReading;

@end

NS_ASSUME_NONNULL_END
